From: Jasper St. Pierre Date: Thu, 14 Mar 2013 17:59:30 +0000 (-0400) Subject: background: Fix updating existing images that need loading X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~4466 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=17591117c1b9f7e21204def88dc874a3c6586c03;p=gnome-shell.git background: Fix updating existing images that need loading Due to weird and strange JS scoping semantics, if we are in a callback, "i" won't be captured and when the callback is called, we'll have the wrong index, causing addImage to be called instead of updateImage. https://bugzilla.gnome.org/show_bug.cgi?id=695882 --- diff --git a/js/ui/background.js b/js/ui/background.js index bb1b2f8d0..9e3e0099d 100644 --- a/js/ui/background.js +++ b/js/ui/background.js @@ -407,7 +407,7 @@ const Background = new Lang.Class({ style: this._style, filename: files[i], cancellable: this._cancellable, - onFinished: Lang.bind(this, function(content) { + onFinished: Lang.bind(this, function(content, i) { numPendingImages--; if (!content) { @@ -427,7 +427,7 @@ const Background = new Lang.Class({ this._setLoaded(); this._updateAnimationProgress(); } - }) + }, i) }); } },